<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="f" uri="http://www.slim3.org/functions"%>
<%@ page import="jp.co.cos.ittrick.channel.model.ChannelModel" %>
<%@ page import="jp.co.cos.ittrick.channel.model.CategoryModel" %>
<%@ page import="jp.co.cos.ittrick.channel.model.ChapterModel" %>
<%@ page import="jp.co.cos.ittrick.channel.model.PageModel" %>
<%@ page import="jp.co.cos.ittrick.channel.model.ApplicationModel" %>
<%@ page import="java.util.List" %>
<html lang="ja">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>${applicationModel.applicationName }：IT TRICK</title>
	<meta name="description" content="${applicationModel.description }" />
	<meta name="keywords" content="${applicationModel.keyWordListString}" />
	<link rel="icon" type="image/gif" href="/favicon.png" >
	<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss">
	<link href="/css/reset.css" rel="stylesheet" type="text/css" media="screen" />
	<link href="/css/common.css" rel="stylesheet" type="text/css" media="screen" />
	<link href="/css/index.css" rel="stylesheet" type="text/css" media="screen" />
	<script src="/js/modernizr-1.1.min.js"></script>
	<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
</head>
<body>

<!---header start-->
	<jsp:include page="/common/header.jsp" />
<!---header end-->

<!-- contents -->
	<div id="contents" class="clear">
	<!-- mainContent -->
		<div id="mainContent">
			<article>

			<!-- mainTopContent -->
				<section id="mainTopContent">
					<h1>${applicationModel.applicationName } とは</h1>
					${applicationModel.contentString }
				</section>
			<!-- /mainTopContent -->

			<%
			List<ChannelModel> channelList = (List<ChannelModel>)request.getAttribute("channelList");
			ApplicationModel applicationModel = (ApplicationModel)request.getAttribute("applicationModel");
			if(channelList.size() > 0) {
			%>
			<div id="features">
				<%
				for(int i=0; i < channelList.size(); i++) {
					ChannelModel channelModel = channelList.get(i);
					if((i + 1)%2 != 0) {
				%>
				<div class="c12">
				<%	}else { %>
				<div class="c22">
				<%	} %>
					<div class="imgleft">
						<img alt="<%=channelModel.getName() %>" height="110" src="http://ittrick.vs.land.to/<%=applicationModel.getApplicationId() %>/images/<%=channelModel.getKeyString() %>.png" width="110">
					</div>
					<h3><a href="/<%=channelModel.getKeyString() %>.html"><%=channelModel.getName() %></a></h3>
					<p><%=channelModel.getDescription() %></p>
				</div>
				<%
					if((i + 1)%2 == 0 || (i + 1) == channelList.size()) {
				%>
				<div class="spacer"></div>
				<%	} %>
				<%} %>
			</div>
			<%} %>

			<!-- mainLeftContent -->
				<div id="mainLeftContent">
					<h2>What's New!</h2>
					<nav>
						<ul>
							<%
							List<PageModel> pageList = (List<PageModel>)request.getAttribute("pageList");
							for(PageModel pageModel: pageList) {
								ChapterModel chapterModel = pageModel.getChapterModelRef().getModel();
								ChannelModel channelModel = chapterModel.getCategoryModelRef().getModel().getChannelModelRef().getModel();
								String dateTime = new java.text.SimpleDateFormat( "yyyy-MM-dd", java.util.Locale.US).format(pageModel.getPublicDate());
								String dateValue = new java.text.SimpleDateFormat( "yyyy年MM月dd日", java.util.Locale.US).format(pageModel.getPublicDate());
							%>
							<li class="navi">
								[<time datetime="<%=dateTime%>"><%=dateValue%></time>]
								<a href="/<%=channelModel.getKeyString() %>/c<%=chapterModel.getKeyString() %>/page<%=pageModel.getKeyString() %>.html"><%=channelModel.getName()%>-<%=pageModel.getName() %></a>
							</li>
							<% } %>
						</ul>
					</nav>
				</div>
			<!-- /mainLeftContent -->

			<!-- mainRightContent -->
				<div id="mainRightContent" class="clear">
					<!-- socialBtnList -->
					<jsp:include page="/common/socialBtnList.jsp" />
					<!-- /socialBtnList -->
				</div>
			<!-- /mainRightContent -->
			</article>
		</div>
	<!-- /mainContent -->

	<!-- leftContents -->
		<div id="leftContents">

			<!-- AdSense -->
			<jsp:include page="/common/adSense/image_300_250.jsp" />
			<!-- /AdSense -->

			<!-- followMe -->
			<jsp:include page="/common/followMe.jsp" />
			<!-- /followMe -->

			<section>
				<div class="infoBox">
					<header>カテゴリ</header>
					<div class="body">

						<div class="listRelArticle">
							<c:forEach var="channel" items="${channelList}" varStatus="st" >
							<div class="unitRelArticle">
								<p class="ttlArticle"><a href="/${channel.keyString}.html">${channel.name}</a></p>
							</div>
							</c:forEach>
						</div>
					</div>
				</div>
			</section>

			<!-- AdSense -->
			<jsp:include page="/common/adSense/image_300_250.jsp" />
			<!-- /AdSense -->

			<!-- profile -->
			<jsp:include page="/common/profile.jsp" />
			<!-- /profile -->

		</div>
	<!-- /leftContents -->
	</div>
<!-- /contents -->

<!--footer-->
	<jsp:include page="/common/footer.jsp" />
<!-- /footer-->

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) {return;}
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/ja_JP/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
</body>
</html>
